package com.sky.controller.admin;


import com.sky.dto.ScriptTagRelationsDTO;
import com.sky.entity.ScriptTagRelations;
import com.sky.exception.BaseException;
import com.sky.result.Result;
import com.sky.service.ScriptTagRelationsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author majun
 * @package com.sky.controller.admin
 * @date 2025/6/21 15:08
 */
@RestController
@RequestMapping("/admin/scriptTagRelations")
@Slf4j
public class ScriptTagRelationsController {

    @Autowired
    private ScriptTagRelationsService scriptTagRelationsService;

    /**
     * 保存和修改标签和剧本关系
     *
     * @param scriptTagRelationsDTO 剧本-标签关联
     * @return 响应数据
     */
    @PostMapping("/save")
    private Result save(@RequestBody ScriptTagRelationsDTO scriptTagRelationsDTO) {

        log.info("保存剧本-标签关联表");

        if (scriptTagRelationsDTO == null) {
            throw  new BaseException("参数错误");
        }

        scriptTagRelationsService.save(scriptTagRelationsDTO);

        return Result.success();

    }

}
